'''
    离散节点
'''

import numpy as np
import matplotlib.pyplot as plt
from scipy import interpolate
from mpl_toolkits.mplot3d import Axes3D

x=np.array([129,140,103.5,88,185.5,195,105,157.5,107.5,77,81,162,162,117.5])
y=np.array([7.5,141.5,23,147,22.5,137.5,85.5,-6.5,-81,3,56.5,-66.5,84,-33.5])
z=np.array([4,8,6,8,6,8,8,9,9,8,8,9,4,9])
f=interpolate.interp2d(x,y,z)
x_new,y_new=np.meshgrid(np.arange(x.min(),x.max()+1,5),np.arange(y.min(),y.max()+1,5))
z_new=np.array([f(xi,yi) for xi,yi in zip(np.array(x_new).reshape(1,1104)[0],np.array(y_new).reshape(1,1104)[0])]).reshape(46,24)
fig=plt.figure()
ax=Axes3D(fig)
ax.plot_surface(x_new,y_new,z_new,cmap=plt.get_cmap('rainbow'))
ax.contour(x_new,y_new,z_new,zdir='z',offset=-2,cmap='rainbow')
plt.show()
